package com.lcf.app.client1.component;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

/**
 * @author ChenFei
 * @date 2021/11/26
 */
@EnableScheduling
@Component
public class TaskDemo {

    private static final Logger log = LoggerFactory.getLogger(TaskDemo.class);


    @Scheduled(fixedRateString = "5000")
    public void myTask() {
        log.info("当前时间 : {}", DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").format(LocalDateTime.now()));
    }

}
